package org.linlinjava.litemall.web.controller;


import io.swagger.annotations.Api;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LitemallUser;
import org.linlinjava.litemall.web.annotation.LogAnno;
import org.linlinjava.litemall.web.service.WebUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * web用户控制器
 *
 * @author yliyun
 * @date 2022/09/14
 */
@Api(value="用户controller",tags={"用户操作接口"})
@RestController
@RequestMapping("/web/user")
public class WebUserController {

    /**
     * 网络用户服务
     */
    @Autowired
    private WebUserService webUserService;

    /**
     * 充电
     *
     * @param userId 用户id
     * @param amount 量
     * @return {@link ResponseUtil.Response}<{@link LitemallUser}>
     */
    @PutMapping("recharge")
    @LogAnno
    public ResponseUtil.Response recharge(@RequestParam Integer userId, @RequestParam BigDecimal amount){
        return webUserService.recharge(userId,amount);
    }
}
